home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 July / EnigmA AMIGA RUN 20 (1997)(G.R. Edizioni)(IT)[!][issue 1997-07 & 08][EAR-CD IV].iso / earcd / comm / ums / pint.lha / UMS / Rexx / CancelMsg.pint < prev    next >
Text File  |  1997-03-04  |  2KB  |  92 lines

  1. /*
  2.  
  3.    $VER: CancelMsg.pint 1.3 (12.3.96)
  4.  
  5.    Author:
  6.     Matthias Scheler <tron@lyssa.owl.de>
  7.     Martin Koyro <mk@bones.westfalen.de>
  8.  
  9.    Updated for PINT (22.2.97):
  10.     Magnus Heino (nd95mho@Student.HGS.SE)
  11.  
  12.    Function:
  13.     generates a cancel-msg for a usenetarticel.
  14.  
  15.    History:
  16.     1.0   Initial version.
  17.     1.1   Control-line is now quoted.
  18.     1.2   Asks if the message should be canceled.
  19.           The message will be deleted after the cancel is generated.
  20.     1.3   Article window is updated with "REMOVEDELETED",
  21.           "Approved:" header missing in previous versions is generated now.
  22.  
  23.    Requires:
  24.     UMS, PINT 2.0
  25.  
  26.    Example for "ums.config":
  27.     ( PINT.Rexx
  28.     ...
  29.         "#?Window F6 CancelMsg.pint\n"
  30.     ...
  31.     )
  32.  
  33. */
  34.  
  35. OPTIONS RESULTS
  36.  
  37. CALL ADDLIB('ums.library',0,-210,11)
  38. CALL UMSInitConsts()
  39.  
  40. STATUS
  41. IF RESULT~='MESSAGE' THEN EXIT 5
  42.  
  43. GETACCOUNT
  44. OldAccount=RESULT
  45.  
  46. Account=UMSDupAccount(OldAccount)
  47.  
  48. GETMSGNUM
  49. MsgNum=RESULT
  50.  
  51. DROP Fields.
  52.  
  53. IF UMSReadMsgHeader(Account,MsgNum,Fields.,TRUE) THEN
  54.  DO
  55.   IF Symbol('Fields.UMSCODE_GROUP')='VAR' THEN
  56.    DO
  57.     IF UMSReadMsgInfo(Account,MsgNum,info.) THEN
  58.      DO
  59.       IF BitTst(info.USERSTAT,UMSUSTAT_OWNER) THEN
  60.        DO
  61.         User=UMSReadConfig(Account,"rfc.username")
  62.         IF User="" THEN User="nobody"
  63.  
  64.         Domain=UMSReadConfig(Account,"rfc.domainname")
  65.         IF Domain="" THEN Domain="no.where"
  66.  
  67.         'REQUEST "CancelMsg" "**_Yes|No" "Cancel this message?"'
  68.         IF RESULT=1 THEN
  69.          DO
  70.           DROP newmsg.
  71.  
  72.           newmsg.UMSCODE_MSGID   ="cancel"||"."||Fields.UMSCODE_MSGID
  73.           newmsg.UMSCODE_GROUP   =Fields.UMSCODE_GROUP
  74.           newmsg.UMSCODE_SUBJECT ="cmsg cancel <"||Fields.UMSCODE_MSGID||">"
  75.           newmsg.UMSCODE_MSGTEXT ="Canceled by author."||D2C(10)
  76.           newmsg.UMSCODE_RFCATTR ='"Control: cancel <'||Fields.UMSCODE_MSGID||'>" '||'"Approved: '||User||'@'||Domain||'"'
  77.  
  78.           IF UMSWriteMsg(Account,newmsg.)~=0 THEN
  79.            DO
  80.             'REQUEST "CancelMsg" "**_OK" "Cancel generated!"'
  81.             IF ~UMSDeleteMsg(Account,msgnum) THEN 'REQUEST "CancelMsg" "**_OK" "Can not delete message!"'
  82.             ELSE 'REMOVEDELETED'
  83.            END
  84.          END
  85.        END
  86.       ELSE 'REQUEST "CancelMsg" "**_OK" "You are not the owner of this message!"'
  87.      END
  88.    END
  89.  END
  90.  
  91. CALL UMSLogout(Account)
  92.